package it.unibz.ti2.internetPizzeria.utils;

import it.unibz.ti2.internetPizzeria.entities.Order;
import it.unibz.ti2.internetPizzeria.webAttributes.OrderInfo;

import java.util.ArrayList;
import java.util.List;

/**
 * Provides helper method for transforming list of Order objects to list of OrderInfo objects
 */
public class OrderUtil {

	/**
	 * Transforms list of Order objects to list of OrderInfo objects
	 * @param orders orders list
	 * @return list of OrderInfo objects
	 */
	public static List<OrderInfo> getOrderInfos(List<Order> orders){
		List<OrderInfo> orderInfos = new ArrayList<OrderInfo>();
		for (Order order : orders) {
			orderInfos.add(new OrderInfo(order));
		}
		return orderInfos;
	}
}
